package com.example.tuter.util;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

import com.example.tuter.MyApplication;
import com.example.tuter.activity.WebViewActivity;

public class ToastUtil {


    public static void showToastShort(String TAG,String str) {
        Log.d(TAG, "showToastShort: "+str);
        Toast.makeText(MyApplication.getContext(), str, Toast.LENGTH_SHORT).show();
    }

    public static void showToastLong(String TAG,String str){
        Log.d(TAG, "showToastLong: "+str);
        Toast.makeText(MyApplication.getContext(), str, Toast.LENGTH_LONG).show();
    }
    public static void isTurnToXXMHLogin(Context context) {
        AlertDialog dialog = new AlertDialog.Builder(context)
                .setTitle("信息门户信息好像失效了")//设置对话框的标题
                .setMessage("想要使用更多的信息门户信息，需要登录哦")//设置对话框的内容
                //设置对话框的按钮
                .setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                })
                .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Intent intent = new Intent(context, WebViewActivity.class);
                        context.startActivity(intent);
                        dialog.dismiss();
                    }
                }).create();
        dialog.show();
    }


}
